<!DOCTYPE html>
<html lang="en">
<head>
    <{include file="header.html"}>
    <title>组卷管理-<{$user_data['school_name']}>-德安信会计在线教育平台</title>
</head>
<body>
<div class="wrap">
    <!--star left-->
    <div class="column">
        <{include file="left_menu.html"}>
    </div>
    <div id="ContMianBox">
        <!--star子栏目-->
        <div class="sub-colum">
                <div class="tit"><{$left_menu_min.menu}></div>
                <ul>
                    <{foreach from=$left_menu_min.list item=item}>
                    <li <{if $item['url'] == $left_menu_min.curr}>class="curr"<{/if}>><a href="<{$item['url']}>"><{$item['name']}></a></li>
                    <{/foreach}>
                </ul>
            </div>
        <!--end子栏目-->
        <!--end left-->
        <div class="container narrow">
            <!--star conter-->
            <div class="cetContent">
                <div class="tit p-lr20">
                    <span class="curr"><{if $type == 3}>作业<{else}>考试<{/if}>列表</span>
                    <!-- <span><a href="/tiku/test_volume">发布作业</a></span> -->
                </div>
                <!--star内容区域-->
                <div class="mainScroll">
                    <div class="mainContainer line-all">
                        <!--star tabMainCont-->
                        <div class="tabMainCont">
                            <!--star会员管理-->
                            <fieldset class="layui-elem-field">
                                <legend>筛选</legend>
                                <div class="layui-field-box">
                                    <form class="layui-form layui-form-pane1" method="post" action="/classes/volume_list">
                                        <input type="hidden" name="type" value="<{$type}>"/>
                                        <div class="layui-form-item">

                                            <div class="layui-inline">
                                                <input type="text" class="layui-input" style="width:200px;" placeholder="名称" value="<{if !empty($conditions.home_work_name)}><{$conditions.home_work_name}><{/if}>"  name="home_work_name" />
                                            </div>

                                            <div class="layui-inline">
                                                <select name="subject_id" id="subject_id" lay-verify="required">
                                                    <option value="0">选择科目</option>
                                                    <{foreach from=$subject item=item}>
                                                        <option value="<{$item.id}>" <{if  $conditions.subject_id == $item.id}>selected<{/if}>><{$item.title}></option>
                                                    <{/foreach}>
                                                </select>
                                            </div>

                                            <div class="layui-inline">
                                                <select name="classes_id">
                                                    <option value="0">全部班级</option>
                                                    <{foreach from=$classes item=class}>
                                                        <option value="<{$class.id}>" <{if  $conditions.classes_id == $class.id}>selected<{/if}>><{$class.class_name}></option>
                                                    <{/foreach}>
                                                </select>
                                            </div>

                                            <div class="layui-inline">
                                                <select name="status">
                                                    <option value="0">状态</option>
                                                    <option value="1" <{if $conditions.status == 1}>selected<{/if}>>进行中</option>
                                                    <option value="2" <{if $conditions.status == 2}>selected<{/if}>>已结束</option>
                                                </select>
                                            </div>

                                            <div class="layui-inline" style="margin-right: 0px;">
                                                <input type="text" name="start_time" id="start_time" lay-verify="required|date" placeholder="作业开始时间" autocomplete="off" class="layui-input" value="<{if !empty($conditions.start_time)}><{$conditions.start_time|date_format:'%Y-%m-%d'}><{/if}>" >
                                            </div>
                                            -
                                            <div class="layui-inline">
                                                <input type="text" name="end_time" id="end_time" lay-verify="required|date" placeholder="作业结束时间" autocomplete="off" class="layui-input" value="<{if !empty($conditions.end_time)}><{$conditions.end_time|date_format:'%Y-%m-%d'}><{/if}>"  >
                                            </div>

                                            <div class="layui-inline">
                                                <button type="submit" class="layui-btn">搜索</button>
                                                <!-- <a class="layui-btn" href="/classes/add_home_work"><i class="layui-icon"></i> 添加作业</a> -->
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </fieldset>
                            <table class="layui-table" lay-even lay-skin="row">
                                <thead>
                                    <tr>
                                        <th>作业名称</th>
                                        <th>科目</th>
                                        <th>添加老师</th>
                                        <th>作业发布时间</th>
                                        <th>做题时长</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <{foreach from=$test_volume_list item=item}>
                                    <tr>
                                        <td class="tal not_lb"><{$item.pname}></td>
                                        <td class="tal not_lb"><{$item.title}></td>
                                        <td class="tal not_lb"><{$item.teacher_name}></td>
                                        <td class="tal not_lb"><{$item.add_time|date_format: '%Y-%m-%d <br/> %H:%M'}></td>
                                        <td class="tal not_lb"><{$item.timeout}>分钟</td>
                                        <td class="tal not_lb">
                                            <div class="colorBtn">
                                                <p><a class="c-3283fa" href="/classes/volume_historys/<{$item.p_id}>/<{$type}>">查看详情</a>
                                                &nbsp;&nbsp;&nbsp;<a class="c-3283fa" href="/classes/delete/<{$item.p_id}>">删除</a>
                                                </p>
                                            </div>
                                        </td>
                                    </tr>
                                <{/foreach}>
                            </table>
                            <div class="pages p-tb20" style="text-align:right;">
                                <!-- <div class="l">
                                    <a href="javascript:;" class="zent-btn">你想要的按钮</a>
                                </div> -->
                                <{$pagination}>
                            </div>

                        </div>
                        <!--star会员管理-->
                    </div>
                    <!--end tabMainCont-->
                </div>
            </div>
        </div>
    </div>
</div>
<{include file="footer.html"}>
<script>
    layui.use(['form', 'jquery', 'layedit', 'laydate'], function(){
        var layedit = layui.layedit,form = layui.form(),$ = layui.jquery, laydate = layui.laydate;
        var start = {
            max: '2099-06-169'
            ,istoday: false
            ,format: 'YYYY-MM-DD'
            ,choose: function(datas){
            end.min = datas; //开始日选好后，重置结束日的最小日期
            end.start = datas //将结束日的初始值设定为开始日
            }
        };
      
        var end = {
            max: '2099-06-16'
            ,istoday: false
            ,format: 'YYYY-MM-DD'
            ,choose: function(datas){
            start.max = datas; //结束日选好后，重置开始日的最大日期
            }
        };
      
        document.getElementById('start_time').onclick = function(){
            start.elem = this;
            laydate(start);
        }
        document.getElementById('end_time').onclick = function(){
            end.elem = this
            laydate(end);
        }

        $(".publish").click(function(){
            var _this = $(this);
            var volume_id = $(this).attr("volume_id");
            var type = $(this).attr("publish_type");
            layer.prompt({title: '请输入该试卷的答题时长（单位：分钟）', formType: 3}, function(text, index){
                if(isNaN(text)){
                    layer.msg("时长必须是数字！", {icon:5, anim: 6});
                    return false;
                }
                layer.close(index);
                $.ajax({
                    type: "POST",
                    url: "/tiku/publish_volume",
                    dataType:"json",
                    data:{'type':type,'volume_id':volume_id, 'timeout':text},
                    success: function(result){
                        // layer.close(ii);
                        if(result.error == 0){
                            layer.msg(result.msg, {icon:6});
                            _this.text(result.msg);
                            _this.unbind("click");
                        }else{
                            layer.msg(result.msg, {icon:5});
                        }
                    }
                });
            });
        })
        
    });
</script>
</body>
</html>
